This application incorporates by reference Taiwanese application Ser. No. 88109969, filed Jun. 15, 1999.
1. Field of the Invention
The invention relates in general to an image compression method and a device therefor, and more particularly to a method for compressing image data with a fixed rate and a device therefor.
2. Description of the Related Art
For current information technical staff, especially personal computer (PC) users, there has been developed a new multi-media mode. Data in a multi-media mode appears in text, audio, voice, etc. In order to function in a multi-media mode, many multi-media devices have been developed to capture image or sound.
Scanners and digital cameras are the most popular devices used to capture image data. A flatbed scanner, the most popular scanner, scans and converts documents into digital data during a scanning process. The digital data is received by PC for a further processing. Generally, a photo-electronic sensing module in the scanner includes a photo-electronic sensor. The photo-electronic sensor may be a charge-coupled device (CCD) or a contact image sensor (CIS).
Also, a multi-functional peripheral (MFP) has been developed, for performing multi-functions, e.g., fax, copying, scanning, etc. The MFP combines a fax machine, a copy machine, a scanner, etc. into one device in order to reduce space.
During the scanning process, the reflected light or the transmitted light, from an object to be scanned, is converted into analog signals by the photo-electronic sensor. Then, the analog signals are received through a control circuit by a host machine (e.g., a PC) for image processing.
As known, colored light is composed of green (G) light, red (R) light and blue (B) light. In the following statements, the components of the G light, the R light, and the B light of image data are respectively defined as G data, R data, and B data. The G data, R data, and B data are also collectively called color data.
In the scanning process, the photo-electronic sensing module captures the G data, the R data, and the B data for each pixel in a row of image data, and generates a corresponding analog signal. The analog signals are received by an analog-digital converter (ADC), to provide digital signals to a next circuit. Then, the photo-electronic sensing module repeatedly captures the G data, the R data, and the B data at each pixel in a next row. The scanning process is one of two types: a one-channel scanning process or a three-channel scanning process. A one-channel scanning process captures and generates only one kind of color data (R data, G data, or B data) for each pixel at any one time. A three-channel scanning process captures and generates all color data (R data, G data, and B data) for each pixel at any one time. Obviously, the three-channel scanning process is faster than the one-channel scanning process. The present invention can be applied to both one-channel and three-channel scanning processes. The-two scanning processes are well known by those skilled in the art, and their detailed operations are not described herein.
FIGS. 1A and 1B can be applied to both one-channel and three-channel scanning processes. FIG. 1A shows how the prior art selects initial scanning positions and scanning areas for each color data. In FIG. 1A, each cell.represents a pixel in a row, and a number thereof indicates the pixel location on the row. In the following description, a symbol P(m, n) (m, nxe2x89xa71) presents a pixel value, wherein xe2x80x9cmxe2x80x9d and xe2x80x9cnxe2x80x9d are respectively a row coordinate value and a column coordinate value of the pixel.
In the prior art, when some row, e.g., a (2nxe2x88x921)th row, is scanned, the initial scanning positions of the three color data are all at the first pixel, and the scanning areas thereof comprise an entire row. The resolution of the three-color data is defined together.
FIG. 1B shows the color data contained in each pixel in FIG. 1A. In FIG. 1B, R(m, n), G(m, n) and B(m, n), respectively represent the R data, G data, and B data of the pixel value P(m, n). If one-color data is represented by 8 bits, each pixel value P(m, n) includes 3xc3x978=24 bits. From FIGS. 1A and 1B, it is known that the conventional scanning process transmits all color data (24 bits) each pixel value to the PC.
The bottleneck of the transmission rate in the prior art scanning device or MFP occurs while transmitting color data to the PC. Compressing image data transmitted to the PC is a preferred method to improve the transmission rate.
According to the characteristics of the scanning device of an MFP, an ideal data compression/decompression method must meet the following two requirements.
(1) Fixed Compression Rate:
In the prior art data compression method of the scanning device of an MFP, the simpler the figures to be scanned, the better the compression rate and the lower bit requirement, and vice versa. Generally, simple figures and complex figures are often mixed in the figures to be scanned. When large image data from complex figure is received by a PC, the PC takes more time to receive the large image data, and the processing rate of the PC decreases. Therefore, the scanning rate of the scanner must decrease to meet the slower processing rate of the PC. In the prior art, decreasing the scanning rate is achieved by moving the photo-electronic sensing module at a slower rate. During the slower movement of the sensing module, in order to prevent some image data from being lost, the sensing module has to move backward. The backward movement of the sensing module has an adverse effect on the scanning quality and the scanning rate. Therefore, in the scanner, a data compression method with a fixed compression rate is preferred.
(2) Low Computation Complexity:
The compressed image data is reversed by a decompression method for sequential processing. If the decompression method is too complicated, data decompressing will take a long time. If so, a longer decompression time also makes the whole scanning/processing rate decrease.
It is therefore an object of the invention to provide an improved and simplified image data compression/decompression method and device. The image data compression/decompression methods of the present invention meet fixed compression rate and low computation complexity requirements.
The invention achieves the above-identified objects by providing a method for compressing and decompressing data.
According to the object of the invention, an image data compressing method is provided for compressing input image data having pixel values P(m, n) arranged in M rowsxc3x97N columns, wherein m is defined as a row coordinate value (m=1xcx9cM) and n is defined as a column coordinate value (n=1xcx9cN), each pixel value P(m, n) including first color data C1(m, n), second color data C2(m, n), and third color data C3(m, n).
According to a first aspect of the object, the method includes producing C1(m, n) for all m and n; producing C2(m, n) for odd m and even n; and producing C3(m, n) for even m and odd n. The compression rate is fixed at 50% by applying the present invention. The method may further includes producing C3(m, n) for odd m and odd n; and producing C2(m, n) for even m and even n. According to the latter method, the compression rate is fixed at 66%.
According to another aspect of the object, the method includes producing C1(m, n) for all m and n; producing C2 (m, n) for odd m and odd n; and producing C3(m, n) for even m and even n. The method may further includes producing C3(m, n) for odd m and even n; and producing C2(m, n) for even m and odd n. According to another aspect of the object, the method includes producing C1(m, n) for all m and n; producing C2(m, n) for odd m and odd n; and producing C3(m, n) for even m and odd n. The method may further includes producing C3(m, n) for odd m and odd n; and producing C2(m, n) for even m and odd n. According to another aspect of the object, the method includes producing C1(m, n) for all m and n; producing C2(m, n) for odd m and even n; and producing C3(m, n) for even m and even n. The method may further includes producing C3(m, n) for odd m and even n; and producing C2(m, n) for even m and even n.
The compressed image data includes: (1) compressed first color data Cold(m, n), for any m and n; (2) compressed second color data C2old(m, n), for odd m and n; and (3) compressed third color data C3old(m, n), for even m and n. According to the method of this embodiment, decompressed image data is generated, including at least one of decompressed second color data C2new(m, n) and decompressed third color data C3new(m, n) for each pixel value P(m, n). The method includes generating C2new(m, n) and C3new(m, n) of the pixel value P(m, n) according to an average value of some predetermined surrounding pixels, C1old(m, n), C2old(m, n), and C3old(m, n), by the following functions:
C2new(m, n)=C1old(m, n)+Avg(C2surxe2x88x92C1sur); and
C3new(m, n)=C1old(m, n)+Avg(C3surxe2x88x92C1sur).
The above mentioned Avg(C2surxe2x88x92C1sur) is an average value of C2old(m, n) minus C1old(m, n) of some predetermined surrounding pixels. Similarly, the above mentioned Avg(C3surxe2x88x92C1sur) is an average value of C3old(m, n) minus C1old(m, n) of some predetermined surrounding pixels. In addition, the function Avg(C2surxe2x88x92C1sur) and Avg(C3surxe2x88x92C1sur) can be substituted by WS(C2surxe2x88x92C1sur) and WS(C3surxe2x88x92C1sur) respectively, wherein WS(C2surxe2x88x92C1sur) is a weighted sum of C2old data minus C1old data of some predetermined surrounding pixels; and WS(C3surxe2x88x92C1sur) is a weighted sum of C3old data minus C1old data of some predetermined surrounding pixels.
According to the object of the invention, an image data compression device is provided, for providing compressed image data to a host machine. The image data compression device includes a photo-electronic sensing module, for capturing a plurality of pixel values corresponding to input image data, wherein each pixel value includes first color data, second color data, and third color data, arranged in rows; and a signal converting/processing unit, for receiving the plurality of pixel values and generating the compressed image data based on the received pixel values such that the compressed image data is arranged in alternating rows of two types, wherein the first type includes all of the first color data and part of the second color data, and the second type includes all of the first color data and part of the third color data. The photo-electronic sensing module may be a charge-coupled device or a contact image sensor. The signal converting/processing unit may include an analog/digital converter, for converting the pixel values from analog form to digital form; and a digital-signal processing unit, for receiving the pixel values in digital form and generating the compressed image data. The image data compression device may also include a scanning control unit, for providing a control signal to the signal converting/processing unit; an output buffer, for receiving the compressed image data from the signal converting/processing unit; and an interface, connecting the output buffer and the host machine. The host machine may be a personal computer. The part of the second color data of the first type row may include second color data of a first pixel of each first type row and of each alternating pixel of each first type row, or may include second color data of a second pixel of each first type row and of each alternating pixel of each first type row. Likewise, the part of the third color data of the second type row may include third color data of a first pixel of each second type row and of each alternating pixel of each second type row, or may include third color data of a second pixel of each second type row and of each alternating pixel of each second type row.
According to the object of the invention, an image data compression device is provided, for providing a compressed image data to a host machine. The image data compression device includes a photo-electronic sensing module, for capturing a plurality of pixel values corresponding to input image data, wherein each pixel value comprises first color data, second color data, and third color data, arranged in rows; a signal converting/processing unit, for receiving the plurality of pixel values and providing an output corresponding to the pixel values; and a compression control unit, for receiving the output from the signal converting/processing unit, and generating the compressed image data based on the received pixel values such that the compressed image data is arranged in alternating rows of two types, wherein the first type comprises all of the first color data and part of the second color data, and the second type comprises all of the first color data and part of the third color data. The photo-electronic sensing module may be a charge-coupled device or a contact image sensor. The signal converting/processing unit may include an analog/digital converter, for converting the pixel values from analog form to digital form; and a digital-signal processing unit, for receiving the pixel values in digital form and providing a digital output corresponding to the pixel values. The image data compression device may also include an output buffer, for receiving the compressed image data from the compression control unit; and an interface connecting the output buffer and the host machine. The host machine may be a personal computer. The part of the second color data of the first type row may include second color data of a first pixel of each first type row and of each alternating pixel of each first type row, or may include second color data of a second pixel of each first type row and of each alternating pixel of each first type row. Likewise, the part of the third color data of the second type row may include third color data of a first pixel of each second type row and of each alternating pixel of each second type row, or may include third color data of a second pixel of each second type row and of each alternating pixel of each second type row.
In all of the above-described statement, the first color data is green data, the second color data is blue data, and the third color data is red data; or the first color data is green data, the second color data is red data, and the third color data is blue data; or the first color data is yellow data, the second color data is cyan data, and the third color data is magenta data; or the first color data is yellow data, the second color data is magenta data, and the third color data is cyan data.